#include<iostream>

#ifndef DWAYMERGE_H
#define DWAYMERGE_H

struct Element{
        int index;
        int data;
        };


class dWayMerge
{

	int position;
	Element *heapspace;

	public:
	dWayMerge()
	{
		position = 0;
		heapspace = NULL; 
	}
	

	int heapIntialize( int space );
	void heapPrint();
	void heapClean();
	int heapIsEmpty();
	
	int heapInsert(Element e);
	Element heapRemoveMax();
	void heapSortInterface();

	~dWayMerge()
	{
		delete heapspace;
		position = 0;
	};
	
	private :
	
	void heapSort(Element *heapspace, int left , int right );
	int fixHeapDown(Element *headspace,int pos,int position);
	int fixHeapUp(int position);
	int SWAP( Element* a, Element* b);
	


	

};

#endif
